package cn.tedu.rewrite;

/**
 * @author :Colin
 * @version 创建时间: 2021/6/25 10:19
 */
public class Student {




        //1.定义成员变量
        public String name;
        public int age;

        //2.定义构造方法
    public Student(){//注意手动添加无参构造，防止被后续添加的含参构造覆盖

    }

    public Student(String name, int age) {
        //int a;
        this.name = name;
        this.age = age;

    }
        public void eat(){

        System.out.println("坚持住，马上吃饭");
        this.play(1);
    }
        public int play(int n){
        System.out.println("今天我要玩"+n+":个小时代码");
        return n;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
